package com.zb.annotation;

import com.zb.validation.ListValidator;
import com.zb.validation.NumberValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.List;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * list集合校验
 * @Author WEN
 * @Date 2024/2/4 0004
 **/
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RUNTIME)
@Documented
@Constraint(
        validatedBy = {ListValidator.class} // 标明由哪个类执行校验逻辑
)
public @interface ListPattern {
    /**
     * 是否必填，默认否
     * @return
     */
    boolean required() default false;

    /**
     * 指定值
     * @return
     */
    String[] regexp() default {};

    String message() default "{javax.validation.constraints.Pattern.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
